import sys,time
import os

from Predict_6620Job import Predict_6620Job

def main(bf_no,avg_iron_temp,avg_c_s_value,compute_slag_rate,compute_fill_s_value,
         y1,avg_iron_temp2,avg_c_s_value2,compute_slag_rate2,compute_fill_s_value2):
    y_pred_output = ''
    try:
        avg_iron_temp = float(avg_iron_temp)
        avg_c_s_value = float(avg_c_s_value)
        compute_slag_rate = float(compute_slag_rate)
        compute_fill_s_value = float(compute_fill_s_value)
        y1 = float(y1)
        avg_iron_temp2 = float(avg_iron_temp2)
        avg_c_s_value2 = float(avg_c_s_value2)
        compute_slag_rate2 = float(compute_slag_rate2)
        compute_fill_s_value2 = float(compute_fill_s_value2)
        success_tmp = True
        msg = ''
        timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
    except Exception as e:
        success_tmp = False
        msg = f'invalid_parameter_type--{str(e)}'
        timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
    if success_tmp:
        y_pred_output = Predict_6620Job(p_bf_no=bf_no, p_avg_iron_temp=avg_iron_temp, p_avg_c_s_value=avg_c_s_value, p_compute_slag_rate=compute_slag_rate, p_compute_fill_s_value=compute_fill_s_value,
                                        p_y1=y1, p_avg_iron_temp2=avg_iron_temp2, p_avg_c_s_value2=avg_c_s_value2, p_compute_slag_rate2=compute_slag_rate2, p_compute_fill_s_value2=compute_fill_s_value2).execute()
        timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
        success_tmp = True
    success = success_tmp
    message = msg
    timestamp = timestamp
    y_pred_output = y_pred_output
    return success, message, timestamp, y_pred_output
if __name__ == '__main__':
    bf_no = 1
    avg_iron_temp = 1511
    avg_c_s_value = 122
    compute_slag_rate = 303
    compute_fill_s_value = 349
    y1 = 31
    avg_iron_temp2 = 1511
    avg_c_s_value2 = 122
    compute_slag_rate2 = 303
    compute_fill_s_value2 = 380
    success, message, timestamp, y_pred_output = main(bf_no,avg_iron_temp,avg_c_s_value,compute_slag_rate,compute_fill_s_value,
                                                      y1,avg_iron_temp2,avg_c_s_value2,compute_slag_rate2,compute_fill_s_value2)
    print(success, message, timestamp, y_pred_output)
